<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">
  
        <ui:composition template="templateadmin.xhtml">
            <ui:define name="content">
                <script  type="text/javascript">
                  function testResults (form) {
                      var TestVar = form.elements["form2:txtPrice"];
                      var tax_id = parseFloat(TestVar.value);
                      if(isNaN(tax_id)){
                          alert ("You have input float");
                          return false;
                      }
                      return true;

                 }

                </script>
                <center><h1>Hotel Management</h1>
                    <br/>
                    <b><a href="newhotel.xhtml" style="color: red">New Hotel</a></b>
                <h:form id="form1">
                    <table border="0" cellpadding="0" cellspacing="0" id="product-table">
                        <tr>
<!--                            <th class="table-header-repeat line-left minwidth-1" width="30px"><a href="">Hotel ID</a>	</th>-->
                            <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Place Name</a></th>
                            <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Hotel Name</a></th>
                            <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Rate</a></th>
                            <th class="table-header-repeat line-left minwidth-1" width="220px"><a href="">Price</a></th>
                            <th class="table-header-repeat line-left minwidth-1" width="120px"><a href="">Images</a></th>
                            <th class="table-header-repeat line-left minwidth-1" width="100px"><a href="">Option</a></th>
                        </tr>
                        <ui:repeat value="#{mngHotelBean.listHotel}" var="hotel">
                            <tr>
<!--                                <td>#{hotel.hotelID}</td>-->
                                <td>
                                    <h:selectOneMenu value="#{hotel.placeID}" styleClass="styledselect_form_1">
                                        <f:selectItems value="#{hotel.listPlaces}" var="place" itemValue="#{place.placeID}" itemLabel="#{place.placeName}"></f:selectItems>
                                    </h:selectOneMenu>
                                </td>
                                <td><h:inputText id="txtName" value="#{hotel.hotelName}" styleClass="inp-form" required="true" requiredMessage="This field is required."></h:inputText>
                                    <br/>
                                    <h:message for="txtName" styleClass="error-inner"></h:message>
                                </td>
                                <td>
                                    <h:selectOneMenu value="#{hotel.rate}" styleClass="styledselect_form_1">
                                        <f:selectItem itemValue="1"  itemLabel="1"></f:selectItem>
                                        <f:selectItem itemValue="2" itemLabel="2"></f:selectItem>
                                        <f:selectItem itemValue="3" itemLabel="3"></f:selectItem>
                                        <f:selectItem itemValue="4" itemLabel="4"></f:selectItem>
                                        <f:selectItem itemValue="5" itemLabel="5"></f:selectItem>
                                    </h:selectOneMenu>
                                </td>
                                <td><h:inputText id="txtPrice" value="#{hotel.price}" styleClass="inp-form" required="true" requiredMessage="This field is required."></h:inputText>
                                    <br/>
                                    <h:message for="txtPrice" styleClass="error-inner"></h:message>
                                </td>
                                <td>
                                    <img src="#{hotel.images}" width="80px" height="80px" alt="abc"/>
                                </td>
                                <td><h:commandButton action="#{mngHotelBean.updateHotelModelAction(hotel)}" value="Update" styleClass="form-update"></h:commandButton></td>
                            </tr>
                        </ui:repeat>
                    </table>
                </h:form>
                Page : <ui:repeat value="#{mngHotelBean.pageList}" var="page">
                    <a href="managementhotels.xhtml?pageID=#{page}">#{page}</a> - 
                </ui:repeat>
                <br/>
                </center>
            </ui:define>
        </ui:composition>
    
</html>

